stage.set_background("schoolentrance")
stage.wait(2)
stage.create_grid_overlay(50, "blue")
stage.set_background_color("azure")
emma = codesters.Sprite("person1")
emma.set_size(0.5)
michael = codesters.Sprite("person2")
michael.set_size(0.5)
emma_x = random.randint(-230,230)
t = codesters.Teacher()
rands = t.get_parameters_for_function('randint')
try:
tval_1 = rands[1]
except:
tval_1 = "DNE"
try:
tval_2 = emma_y
except:
tval_2 = "DNE"
t1 = TestObjective()
t1.add_success(tval_1 == ['-230', '230'], "Great job!")
t1.add_failure(tval_1 == "DNE", "Did you create the random variable?")
t1.add_failure(tval_1 == ['1', '10'], "Did you change the integers in random.randint() to -230, 230?")
t1.add_creative(tval_1 != ['-230', '230'] and tval_1 != "DNE", "That range of numbers is good too!")
t2 = TestObjective()
t2.add_success(tval_2 != "DNE", "Great job!")
t2.add_failure(tval_2 == "DNE", "Did you change the name of the variable to emma_y?")
tester = TestManager()
tester.add_test_list([t1,t2])
tester.run_tests()
tester.display_first_feedback()
-
Run Code
-
Activity Submitted!
Submit Work
-
Next Activity
-
Stop Running Code
-
Show Chart
-
Show Console
-
Reset Code Editor
-
Codesters How To (opens in a new tab)